/*
 * Bank.h
 *
 *  Created on: Jun 14, 2011
 *      Author: rishirajbheda
 */

#ifndef MANIFOLD_CAFFDRAM_BANK_H_
#define MANIFOLD_CAFFDRAM_BANK_H_

#include "Dsettings.h"
#include "Dreq.h"

#include <iostream>

/*
 *
 */

namespace manifold {
namespace caffdram {

class Bank {
public:

	unsigned long int processRequest(Dreq* dRequest);

	Bank(const Dsettings* dramSetting);
	~Bank();

	void print_stats(std::ostream&);

#ifdef CAFFDRAM_TEST
public:
#else
private:
#endif
	const Dsettings* dramSetting;
	unsigned int lastAccessedRow;
	bool firstAccess;
	unsigned long int bankAvailableAtTime;

	unsigned long int processOpenPageRequest (Dreq* dRequest);
	unsigned long int processClosedPageRequest (Dreq* dRequest);

	//stats
	unsigned long stats_num_requests; //number of requests
	double stats_total_latency;
};

} //namespace caffdram
} //namespace manifold

#endif // MANIFOLD_CAFFDRAM_BANK_H_
